//靶标类别 等定义
const categoryMixin = {
  data() {
    return {
      categoryObj: {
        '1': {
          label: '一类',
          value: '1'
        },
        '2': {
          label: '二类',
          value: '2'
        },
        '3': {
          label: '三类',
          value: '3'
        }
      }
    };
  },
  computed: {
    categoryArr() {
      return Object.values(this.categoryObj);
    }
  },
  methods: {
    // 困难程度
    filterCategory(val) {
      return this.categoryObj[val] ? this.categoryObj[val].label : '无';
    }
  }
};
const scoreRuleMixin = {
  data() {
    return {
      dangerLevelObj: {
        high: {
          label: '高危',
          value: 'high'
        },
        middle: {
          label: '中危',
          value: 'middle'
        },
        low: {
          label: '低危',
          value: 'low'
        }
      },
      contraposeObj: {
        '1': {
          label: '防守方',
          value: '1'
        },
        '2': {
          label: '攻击方',
          value: '2'
        }
      },
      wayObj: {
        auto: {
          label: '自动',
          value: 'auto'
        },
        hand: {
          label: '手动',
          value: 'hand'
        }
      },
      subScoreObj: {
        add: {
          label: '加分',
          value: 'add'
        },
        sub: {
          label: '减分',
          value: 'sub'
        }
      },
      booleanObj: {
        true: {
          label: '是',
          value: 1
        },
        false: {
          label: '否',
          value: 0
        }
      }
    };
  },
  computed: {
    levelArr() {
      return Object.values(this.dangerLevelObj);
    },
    wayArr() {
      return Object.values(this.wayObj);
    },
    contraposeArr() {
      return Object.values(this.contraposeObj);
    },
    subScoreArr() {
      return Object.values(this.subScoreObj);
    },
    booleanArr() {
      return Object.values(this.booleanObj);
    }
  },
  mounted() {},
  methods: {
    filterType(obj, val) {
      return val && obj[val] && obj[val].label || '无';
    },
    filterLevel(val) {
      return val && this.dangerLevelObj[val] ? this.dangerLevelObj[val].label : '无';
    },
    filterWay(val) {
      return val && this.wayObj[val] ? this.wayObj[val].label : '无';
    },
    filterSubscore(val) {
      return val && this.subScoreObj[val] ? this.subScoreObj[val].label : '无';
    },
    filterContrapose(val) {
      return val && this.contraposeObj[val] ? this.contraposeObj[val].label : '无';
    },
    filterBoolean(val) {
      return val && this.booleanObj[val] ? this.booleanObj[val].label : '无';
    }
  }
};

export { categoryMixin, scoreRuleMixin };
